package com.site.controller.site;

import com.site.service.BannerService;
import com.site.service.InfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by robin on 2016/12/19.
 * 首页 controller
 */
@Controller
public class HomeController {
    @Autowired
    private BannerService bannerService;
    @Autowired
    private InfoService   infoService;

    @RequestMapping("/")
    public String home(){
        return "redirect:home";
    }

    @RequestMapping("home")
    public String home(Model model){
        model.addAttribute("plate","home");
        model.addAttribute("home",bannerService.selectByCate("home"));
        model.addAttribute("partner",bannerService.selectByCate("partner"));
        model.addAttribute("news",infoService.selectByCate("aboutNews",1,7));
        return "site/home/home";
    }
}
